<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        li{
            list-style: none;
        }
        /* 可以把偶数的孩子选出来 */
        ul li:nth-child(even){
            background-color: red;
        }
        /* 可以把奇数的孩子选出来 */
        ul li:nth-child(odd){
            background-color: skyblue;
        }
        /* 从0开始每次加一等于是选择了全部孩子 */
        ol li:nth-child(2n-1){
            background-color: springgreen;
        }
    </style>
</head>
<body>
    <ul>
        <li>1</li>
        <li>1</li>
        <li>1</li>
        <li>1</li>
        <li>1</li>
        <li>1</li>
        <li>1</li>
        <li>1</li>
    </ul>
    <ol>
        <li>2</li>
        <li>2</li>
        <li>2</li>
        <li>2</li>
        <li>2</li>
        <li>2</li>
        <li>2</li>
        <li>2</li>
    </ol>
</body>
</html>